//index.js
const app = getApp()
const { envList } = require('../../envList.js')
// 调用云数据库
const db = wx.cloud.database();
const _ = wx.cloud.database().command;

Page({
  data: {
    home:[],
    wuData1:0,
  },
  onLoad(){
    this.dataBase();
  },
  // 数据
  dataBase(){
    var that=this;
    var len = that.data.home.length;
    db.collection("yuyue").skip(len).get({
      success:(res)=>{
        that.data.home=[...that.data.home,...res.data];
        that.setData({
          home:that.data.home
        })
        console.log(res.data)
        if(res.data!=""){
          that.setData({
            wuData1:0
          })
        }else{
          that.setData({
            wuData1:1
          })
        }
      },
      fail:(err)=>{
        console.log(err)
      }
    })
  },


  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    var that=this;
    that.dataBase();
  },
})
